package yz.cp.back.u.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.EqualsAndHashCode;
import yz.cp.back.base.BaseEntity;
import yz.cp.back.common.enums.UserAccountStatus;

import java.math.BigDecimal;

/**
 * <p>
 * 资金账户表
 * </p>
 *
 * @author jobob
 * @since 2019-04-03
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class UserAccount extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * id/merchant_id
     */
    private String id;

    /**
     * 账号状态,1:正常,2:冻结
     */
    private Integer status;

    /**
     * 总额度
     */
    private BigDecimal totalLimit;

    /**
     * 可用额度
     */
    private BigDecimal usableLimit;

    /**
     * 已用额度
     */
    private BigDecimal usedLimit;

    /**
     * 资金账户余额
     */
    private BigDecimal moneyAmount;

    /**
     * 可用资金
     */
    private BigDecimal moneyUsable;

    /**
     * 冻结资金
     */
    private BigDecimal moneyFrozen;

    /**
     * 在途资金
     */
    private BigDecimal moneyInTransit;

    /**
     * 保证金账户余额
     */
    private BigDecimal depositAmount;

    /**
     * 可用保证金
     */
    private BigDecimal depositUsable;

    /**
     * 冻结保证金
     */
    private BigDecimal depositFrozen;

    /**
     * 在途保证金
     */
    private BigDecimal depositInTransit;

    /**
     * 资金账户累计充值
     */
    private BigDecimal moneyTotalTopup;

    /**
     * 资金账户累计提现
     */
    private BigDecimal moneyTotalWithdraw;

    /**
     * 保证金账户累计充值
     */
    private BigDecimal depositTotalTopup;

    /**
     * 保证金账户累计提现
     */
    private BigDecimal depositTotalWithdraw;

    /**
     * 保证金账户累计垫付
     */
    private BigDecimal depositTotalTobepayed;

    /**
     * 存续投/融资笔数  investment/financing count
     */
    private Integer ivtFncCount;

    /**
     * 存续投/融资金额(投/融资余额) investment/financing amount
     */
    private BigDecimal ivtFncAmount;

    /**
     * 累计投/融资笔数
     */
    private Integer ivtFncTotalCount;

    /**
     * 累计投/融资金额
     */
    private BigDecimal ivtFncTotalAmount;

    /**
     * 累计保费收入/支出
     */
    private BigDecimal premiumTotalAmount;

    /**
     * 累计销售金额
     */
    private BigDecimal saleTotalAmount;

    /**
     * 实收/实还本息
     */
    private BigDecimal payedAmount;

    /**
     * 实收/实还本金
     */
    private BigDecimal payedPrincipal;

    /**
     * 实收/实还利息
     */
    private BigDecimal payedInterest;

    /**
     * 待收/待还本息
     */
    private BigDecimal dueAmount;

    /**
     * 待收/待还本金
     */
    private BigDecimal duePrincipal;

    /**
     * 待收/待还利息
     */
    private BigDecimal dueInterest;

    /**
     * 逾期笔数
     */
    private Integer overdueCount;

    /**
     * 逾期本息
     */
    private BigDecimal overdueAmount;

    /**
     * 30天内(含30天)逾期笔数
     */
    private Integer overdue1to30Count;

    /**
     * 30天内(含30天)逾期本息
     */
    private BigDecimal overdue1to30Amount;

    /**
     * 30~90天(含90天)逾期笔数
     */
    private Integer overdue30to90Count;

    /**
     * 30~90天(含90天)逾期本息
     */
    private BigDecimal overdue30to90Amount;

    /**
     * 90天以上逾期笔数
     */
    private Integer overdue90toxCount;

    /**
     * 90天以上逾期本息
     */
    private BigDecimal overdue90toxAmount;

    /**
     * 本月应收
     */
    private BigDecimal dueMonth;

    /**
     * 乐观锁
     */
    private Integer version;



    @TableField(exist = false)
    private String statusName;


    public void initName(){
       setStatusName(UserAccountStatus.getByCode(getStatus()).getName());
    }
}
